﻿using LimaLims.Application.Service.Base.Dto;
using LimaLims.Core;
using LimaLims.Core.Entity.Basic;
using LimaLims.Core.Enum;
using LimaLims.Core.Util;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LimaLims.Application.Service.Basic.Dto
{
    public class AddProductInput : BaseDto
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 产品分类
        /// </summary>
        public long CategoryId { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }

        /// <summary>
        /// 所属项目id
        /// </summary>
        public long? ProjectDrawingId { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }

    public class EditProductInput : AddProductInput
    {

    }

    /// <summary>
    /// 产品报告信息
    /// </summary>
    public class ProductReportDetail
    {
        /// <summary>
        /// 任务ID
        /// </summary>
        public long TaskId { get; set; }
        /// <summary>
        /// 产品ID
        /// </summary>
        public long ProductId { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string ProductCode { get; set; }
        /// <summary>
        /// 任务编号
        /// </summary>
        public string TaskCode { get; set; }
        /// <summary>
        /// 试验状态
        /// </summary>
        public ExperimentStatus TaskStatus { get; set; }

        public string TaskStatusText => this.TaskStatus.GetDescription();
        /// <summary>
        /// 试验员
        /// </summary>
        public string ExperimentUserName { get; set; }

        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? ActualStartTime { get; set; }

        /// <summary>
        /// 实际完成时间
        /// </summary>
        public DateTime? ActualEndTime { get; set; }

        public ExperimentResult? Result { get; set; }

        public string ResultText => this.Result.HasValue ? this.Result.GetDescription() : "";
        /// <summary>
        /// 报告地址
        /// </summary>
        public string ReportUrl { get; set; }
    }

    public class ProductOutput : BaseDto
    {
        /// <summary>
        /// 产品名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 产品编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 产品分类Id
        /// </summary>
        public long CategoryId { get; set; }

        /// <summary>
        /// 产品分类名称
        /// </summary>
        public string CategoryName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string Specification { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string Unit { get; set; }

        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }

        /// <summary>
        /// 所属项目
        /// </summary>
        public long? ProjectId { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }

    /// <summary>
    /// 产品分页
    /// </summary>
    public class ProductPageInput : PageInputBase
    {
        /// <summary>
        /// 出厂编号
        /// </summary>
        public string FactoryNumbe { get; set; }
        /// <summary>
        /// 产品编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 产品分类
        /// </summary>
        public long? CategoryId { get; set; }

        /// <summary>
        /// 项目ID
        /// </summary>
        public long? ProjectDrawingId { get; set; }
    }
}
